package com.github.jspxnet.worktask.service;



import java.util.Collection;
import java.util.Map;

/**
 *
 * import org.activiti.engine.ActivitiException;
 * import org.activiti.engine.ActivitiObjectNotFoundException;
 * import org.activiti.engine.query.NativeQuery;
 * import org.activiti.engine.task.IdentityLink;
 * import org.activiti.engine.task.IdentityLinkType;
 * import org.activiti.engine.task.TaskQuery;
 *
 * Created by jspx.net
 *
 * @author: chenYuan
 * @date: 2020/9/12 22:04
 * @description: 当前节点任务操作
 * 可以对用户任务进行增删改查的管理、可以对相关流程的控制、也可以设置一些用户任务的权限信息、
 * 也可以针对用户审批中的一些附加信息。
 *
 *  activityId:就是workNode的id
 *  taskId:就是nodeId
 *  任务表中  activityId 是唯一的, nodeId 会有多个
 *
 *
 *  假如要暂时停止某个流程实例的执行，那么就将其挂起，反之激活。
 *
 **/
public interface TaskService {


    /**
     *
     * @return 新建流程节点
     */
    //WorkTask newTask();

    /**
     *
     * @param nodeId 模版id
     * @return 以模版的方式创建一个新节点
     */
   // WorkTask newTask(String nodeId);


    /**
     * 如果这个任务已经存在于持久化存储中，那么它将被更新。
     * 在保存了新任务之后，传递给该方法的任务实例将使用新创建的任务的id进行更新。
     * @param task 任务
     * @return 将给定的任务保存到持久数据存储中
     */
   // WorkTask saveTask(WorkTask task);


    /**
     * 删除节点流程 删除给定的任务，而不是删除与此任务相关的历史信息。
     * @param id 结点id
     */
    void deleteTask(long id);

    /**
     * Deletes all tasks of the given collection, not deleting historic information that is related to these tasks.
     *
     * @param nodeIds
     *          The id's of the tasks that will be deleted, cannot be null. All id's in the list that don't have an existing task will be ignored.

     */
    void deleteTasks(Collection<String> nodeIds);


    /**
     *  删除历史等一起
     * @param nodeId 节点id
     * @param deleteReason 是否关联删除
     */
    void deleteTask(String nodeId, String deleteReason);



    /**
     * 设置代办人
     * @param nodeId 节点id
     * @param userId 用户id
     */
    void claim(String nodeId, String userId);


    /**
     * 取消 代办人 为了取消任务，使用null用户的
     * @param nodeId 节点id
     */
    void unclaim(String nodeId);

    /**
     * 完成一个任务
     * @param nodeId 节点id
     */
    void complete(String nodeId);


    /**
     * 指定代办人 委托处理 如果没有设置所有者，则所有者将被设置为任务的当前受让人。
     * @param nodeId 节点id
     * @param userId 用户id
     */
    void delegateTask(String nodeId, String userId);

    /**
     * 正在运行的任务表中被委派人办理任务后任务会回到委派人 ，历史任务表中也一样,只是多了一个人进行审批
     * @param nodeId 节点id
     */
    void resolveTask(String nodeId);


    /**
     * 正在运行的任务表中被委派人办理任务后任务会回到委派人 ，历史任务表中也一样,只是多了一个人进行审批
     * @param nodeId 节点id
     * @param variables 变量
     */
    void resolveTask(String nodeId, Map<String, Object> variables);

    /**
     * Similar to {@link #resolveTask(String, Map)}, but allows to set transient variables too.
     */
    void resolveTask(String nodeId, Map<String, Object> variables, Map<String, Object> transientVariables);
/*

    */
/**
     * Called when the task is successfully executed, and the required task parameters are given by the end-user.
     *
     * @param nodeId
     *          the id of the task to complete, cannot be null.
     * @param variables
     *          task parameters. May be null or empty.
     * @throws ActivitiObjectNotFoundException
     *           when no task exists with the given id.
     *//*

    void complete(String nodeId, Map<String, Object> variables);

    */
/**
     * Similar to {@link #complete(String, Map)}, but allows to set transient variables too.
     *//*

    void complete(String nodeId, Map<String, Object> variables, Map<String, Object> transientVariables);

    */
/**
     * Called when the task is successfully executed, and the required task parameters are given by the end-user.
     *
     * @param nodeId
     *          the id of the task to complete, cannot be null.
     * @param variables
     *          task parameters. May be null or empty.
     * @param localScope
     *          If true, the provided variables will be stored task-local, instead of process instance wide (which is the default for {@link #complete(String, Map)}).
     * @throws ActivitiObjectNotFoundException
     *           when no task exists with the given id.
     *//*

    void complete(String nodeId, Map<String, Object> variables, boolean localScope);

    */
/**
     * Changes the assignee of the given task to the given userId. No check is done whether the user is known by the identity component.
     *    指定办理人
     *    将给定任务的受让人更改为给定的userId。
     * @param nodeId
     *          id of the task, cannot be null.
     * @param userId
     *          id of the user to use as assignee.
     * @throws ActivitiObjectNotFoundException
     *           when the task or user doesn't exist.
     *//*

    void setAssignee(String nodeId, String userId);

    */
/**
     * Transfers ownership of this task to another user. No check is done whether the user is known by the identity component.
     * 指定拥有人,默认为发起人
     * @param nodeId
     *          id of the task, cannot be null.
     * @param userId
     *          of the person that is receiving ownership.
     * @throws ActivitiObjectNotFoundException
     *           when the task or user doesn't exist.
     *//*

    void setOwner(String nodeId, String userId);

    */
/**
     *  owner是任务所有者只能是一个，assignee是任务确定的接收者，也只能是一个，candidate是可领取任务的人，那么就会有很多，所以candidate单独放在identitylink表中关联task
     * 这样的{@link IdentityLink}通知了一个特定的标识(如。组或用户)与某个任务相关联(如。
     *     作为候选人,受让人,等等)。
     * Retrieves the {@link IdentityLink}s associated with the given task. Such an {@link IdentityLink} informs how a certain identity (eg. group or user) is associated with a certain task (eg. as
     * candidate, assignee, etc.)
     *//*

    List<IdentityLink> getIdentityLinksForTask(String nodeId);

    */
/**
     * Convenience shorthand for {@link #addUserIdentityLink(String, String, String)}; with type {@link IdentityLinkType#CANDIDATE}
     * 新增组任务的成员
     * @param nodeId
     *          id of the task, cannot be null.
     * @param userId
     *          id of the user to use as candidate, cannot be null.
     * @throws ActivitiObjectNotFoundException
     *           when the task or user doesn't exist.
     *//*

    void addCandidateUser(String nodeId, String userId);

    */
/**
     * Convenience shorthand for {@link #addGroupIdentityLink(String, String, String)}; with type {@link IdentityLinkType#CANDIDATE}
     * 新增组任务的成员
     * @param nodeId
     *          id of the task, cannot be null.
     * @param groupId
     *          id of the group to use as candidate, cannot be null.
     * @throws ActivitiObjectNotFoundException
     *           when the task or group doesn't exist.
     *//*

    void addCandidateGroup(String nodeId, String groupId);

    */
/**
     * Involves a user with a task. The type of identity link is defined by the given identityLinkType.
     *
     * @param nodeId
     *          id of the task, cannot be null.
     * @param userId
     *          id of the user involve, cannot be null.
     * @param identityLinkType
     *          type of identityLink, cannot be null (@see {@link IdentityLinkType}).
     * @throws ActivitiObjectNotFoundException
     *           when the task or user doesn't exist.
     *//*

    void addUserIdentityLink(String nodeId, String userId, String identityLinkType);

    */
/**
     * Involves a group with a task. The type of identityLink is defined by the given identityLink.
     *
     * @param nodeId
     *          id of the task, cannot be null.
     * @param groupId
     *          id of the group to involve, cannot be null.
     * @param identityLinkType
     *          type of identity, cannot be null (@see {@link IdentityLinkType}).
     * @throws ActivitiObjectNotFoundException
     *           when the task or group doesn't exist.
     *//*

    void addGroupIdentityLink(String nodeId, String groupId, String identityLinkType);

    */
/**
     * Convenience shorthand for {@link #deleteUserIdentityLink(String, String, String)}; with type {@link IdentityLinkType#CANDIDATE}
     *
     * @param nodeId
     *          id of the task, cannot be null.
     * @param userId
     *          id of the user to use as candidate, cannot be null.
     * @throws ActivitiObjectNotFoundException
     *           when the task or user doesn't exist.
     *//*

    void deleteCandidateUser(String nodeId, String userId);

    */
/**
     * Convenience shorthand for {@link #deleteGroupIdentityLink(String, String, String)}; with type {@link IdentityLinkType#CANDIDATE}
     *
     * @param nodeId
     *          id of the task, cannot be null.
     * @param groupId
     *          id of the group to use as candidate, cannot be null.
     * @throws ActivitiObjectNotFoundException
     *           when the task or group doesn't exist.
     *//*

    void deleteCandidateGroup(String nodeId, String groupId);

    */
/**
     * Removes the association between a user and a task for the given identityLinkType.
     *
     * @param nodeId
     *          id of the task, cannot be null.
     * @param userId
     *          id of the user involve, cannot be null.
     * @param identityLinkType
     *          type of identityLink, cannot be null (@see {@link IdentityLinkType}).
     * @throws ActivitiObjectNotFoundException
     *           when the task or user doesn't exist.
     *//*

    void deleteUserIdentityLink(String nodeId, String userId, String identityLinkType);

    */
/**
     * Removes the association between a group and a task for the given identityLinkType.
     *
     * @param nodeId
     *          id of the task, cannot be null.
     * @param groupId
     *          id of the group to involve, cannot be null.
     * @param identityLinkType
     *          type of identity, cannot be null (@see {@link IdentityLinkType}).
     * @throws ActivitiObjectNotFoundException
     *           when the task or group doesn't exist.
     *//*

    void deleteGroupIdentityLink(String nodeId, String groupId, String identityLinkType);

    */
/**
     * Changes the priority of the task.
     *
     * Authorization: actual owner / business admin
     * 权限:实际所有者/业务管理员。
     * @param nodeId
     *          id of the task, cannot be null.
     * @param priority
     *          the new priority for the task.
     * @throws ActivitiObjectNotFoundException
     *           when the task doesn't exist.
     *//*

    void setPriority(String nodeId, int priority);

    */
/**
     * Changes the due date of the task
     *
     * @param nodeId
     *          id of the task, cannot be null.
     * @param dueDate
     *          the new due date for the task
     * @throws ActivitiException
     *           when the task doesn't exist.
     *//*

    void setDueDate(String nodeId, Date dueDate);

    */
/**
     * Returns a new {@link TaskQuery} that can be used to dynamically query tasks.
     *//*

    TaskQuery createTaskQuery();

    */
/**
     * Returns a new {@link NativeQuery} for tasks.
     *//*

    NativeTaskQuery createNativeTaskQuery();

    */
/**
     * set variable on a task. If the variable is not already existing, it will be created in the most outer scope. This means the process instance in case this task is related to an execution.
     *//*

    void setVariable(String nodeId, String variableName, Object value);

    */
/**
     * set variables on a task. If the variable is not already existing, it will be created in the most outer scope. This means the process instance in case this task is related to an execution.
     *//*

    void setVariables(String nodeId, Map<String, ? extends Object> variables);

    */
/**
     * set variable on a task. If the variable is not already existing, it will be created in the task.
     *//*

    void setVariableLocal(String nodeId, String variableName, Object value);

    */
/**
     * set variables on a task. If the variable is not already existing, it will be created in the task.
     *//*

    void setVariablesLocal(String nodeId, Map<String, ? extends Object> variables);

    */
/**
     * get a variables and search in the task scope and if available also the execution scopes.
     *//*

    Object getVariable(String nodeId, String variableName);

    */
/**
     * get a variables and search in the task scope and if available also the execution scopes.
     *//*

    <T> T getVariable(String nodeId, String variableName, Class<T> variableClass);

    */
/**
     * checks whether or not the task has a variable defined with the given name, in the task scope and if available also the execution scopes.
     *//*

    boolean hasVariable(String nodeId, String variableName);

    */
/**
     * checks whether or not the task has a variable defined with the given name.
     *//*

    Object getVariableLocal(String nodeId, String variableName);

    */
/**
     * checks whether or not the task has a variable defined with the given name.
     *//*

    <T> T getVariableLocal(String nodeId, String variableName, Class<T> variableClass);

    */
/**
     * The variable for a task. Returns the variable when it is set for the task (and not searching parent scopes). Returns null when no variable is found with the given
     * name.
     *
     * @param nodeId
     *          id of task, cannot be null.
     * @param variableName
     *          name of variable, cannot be null.
     * @return the variable or null if the variable is undefined.
     * @throws ActivitiObjectNotFoundException
     *           when no task is found for the given taskId.
     *//*

    VariableInstance getVariableInstanceLocal(String nodeId, String variableName);

    */
/**
     * checks whether or not the task has a variable defined with the given name, local task scope only.
     *//*

    boolean hasVariableLocal(String nodeId, String variableName);

    */
/**
     * get all variables and search in the task scope and if available also the execution scopes. If you have many variables and you only need a few, consider using
     * {@link #getVariables(String, Collection)} for better performance.
     *//*

    Map<String, Object> getVariables(String nodeId);

    */
/**
     * The variable values for all given variableNames, takes all variables into account which are visible from the given task scope (including parent scopes).
     *
     * @param nodeId
     *          id of taskId, cannot be null.
     * @param variableNames
     *          the collection of variable names that should be retrieved.
     * @return the variables or an empty map if no such variables are found.
     * @throws ActivitiObjectNotFoundException
     *           when no taskId is found for the given taskId.
     *//*

    Map<String, VariableInstance> getVariableInstances(String nodeId, Collection<String> variableNames);

    */
/**
     * get all variables and search only in the task scope. If you have many task local variables and you only need a few, consider using {@link #getVariablesLocal(String, Collection)} for better
     * performance.
     *//*

    Map<String, Object> getVariablesLocal(String nodeId);

    */
/**
     * get values for all given variableNames and search only in the task scope.
     *//*

    Map<String, Object> getVariables(String nodeId, Collection<String> variableNames);

    */
/** get a variable on a task *//*

    Map<String, Object> getVariablesLocal(String nodeId, Collection<String> variableNames);

    */
/** get all variables and search only in the task scope. *//*

    List<VariableInstance> getVariableInstancesLocalByTaskIds(Set<String> taskIds);

    */
/**
     * The variable values for all given variableNames that are defined in the given task's scope. (Does not searching parent scopes).
     *
     * @param nodeId
     *          id of taskId, cannot be null.
     * @param variableNames
     *          the collection of variable names that should be retrieved.
     * @return the variables or an empty map if no such variables are found.
     * @throws ActivitiObjectNotFoundException
     *           when no taskId is found for the given taskId.
     *//*

    Map<String, VariableInstance> getVariableInstancesLocal(String nodeId, Collection<String> variableNames);

    */
/**
     * Removes the variable from the task. When the variable does not exist, nothing happens.
     *//*

    void removeVariable(String nodeId, String variableName);

    */
/**
     * Removes the variable from the task (not considering parent scopes). When the variable does not exist, nothing happens.
     *//*

    void removeVariableLocal(String nodeId, String variableName);

    */
/**
     * Removes all variables in the given collection from the task. Non existing variable names are simply ignored.
     *//*

    void removeVariables(String nodeId, Collection<String> variableNames);

    */
/**
     * Removes all variables in the given collection from the task (not considering parent scopes). Non existing variable names are simply ignored.
     *//*

    void removeVariablesLocal(String nodeId, Collection<String> variableNames);

    //注释和附件
    */
/** Removes all comments from the provided task and/or process instance *//*

    void deleteComments(String nodeId, String processInstanceId);

    */
/**
     * Removes an individual comment with the given id.
     *
     * @throws ActivitiObjectNotFoundException
     *           when no comment exists with the given id.
     *//*

    void deleteComment(String commentId);


    */
/** The all events related to the given task. *//*

    List<Event> getTaskEvents(String nodeId);

    */
/**
     * Returns an individual event with the given id. Returns null if no event exists with the given id.
     *//*

    Event getEvent(String eventId);

    */
/** The comments related to the given process instance. *//*

    List<Comment> getProcessInstanceComments(String processInstanceId);

    */
/** The comments related to the given process instance. *//*

    List<Comment> getProcessInstanceComments(String processInstanceId, String type);

    */
/**
     * Add a new attachment to a task and/or a process instance and use an input stream to provide the content
     *//*

    Attachment createAttachment(String attachmentType, String nodeId, String processInstanceId, String attachmentName, String attachmentDescription, InputStream content);

    */
/**
     * Add a new attachment to a task and/or a process instance and use an url as the content
     *//*

    Attachment createAttachment(String attachmentType, String nodeId, String processInstanceId, String attachmentName, String attachmentDescription, String url);

    */
/** Update the name and description of an attachment *//*

    void saveAttachment(Attachment attachment);

    */
/** Retrieve a particular attachment *//*

    Attachment getAttachment(String attachmentId);

    */
/** Retrieve stream content of a particular attachment *//*

    InputStream getAttachmentContent(String attachmentId);

    */
/** The list of attachments associated to a task *//*

    List<Attachment> getTaskAttachments(String nodeId);

    */
/** The list of attachments associated to a process instance *//*

    List<Attachment> getProcessInstanceAttachments(String processInstanceId);

    */
/** Delete an attachment *//*

    void deleteAttachment(String attachmentId);

    */
/** The list of subtasks for this parent task *//*

    List<Task> getSubTasks(String parentTaskId);
*/
}
